Convenient Macros for Languages with Conventional Alge- braic Syntax
نویسنده
چکیده
Motivation: The ability to extend a language with new syntactic forms is a powerful tool. A sufficiently flexible macro system allows programmers to build from a common base towards a language designed specifically for their problem domain. However, macro facilities that are integrated, capable, and at the same time simple enough to be widely used have been limited to the Lisp family of languages to date. In this project we introduce a macro facility, called the Java Syntactic Extender (JSE) [1], with the superior power and ease of use of Lisp macro systems, but for Java, a language with a more conventional algebraic syntax. The design is based on the Dylan macro system, but exploits Java’s compilation model to offer a full procedural macro engine. In other words, syntax expanders may be implemented in, and so use all the facilities of, the full Java language.
منابع مشابه
The Scribble Reader An Alternative to S-expressions for Textual Content
For decades, S-expressions have been one of the fundamental advantages of languages in the Lisp family — a major factor in shaping these languages as an ideal platform for symbolic computations, from macros and meta-programming to symbolic data exchange and much more. As convenient as this minimalist syntax has proven to be, it is unfitting for dealing with textual content. In this paper we des...
متن کاملTwo Approaches to Portable Macros
For any programming language that supports macros and has multiple implementations (each with dierent AST definitions), there is a common problem: how to make macros that operate on ASTs portable among dierent compiler implementations? Implementing portable macros is especially important for statically typed languages like Scala, as IDE vendors usually have dierent implementations of the lan...
متن کاملMacros that Work Together - Compile-time bindings, partial expansion, and definition contexts
Racket is a large language that is built mostly within itself. Unlike the usual approach taken by non-Lisp languages, the self-hosting of Racket is not a matter of bootstrapping one implementation through a previous implementation, but instead a matter of building a tower of languages and libraries via macros. The upper layers of the tower include a class system, a component system, pedagogic v...
متن کاملThe lambda-calculus is nominal alge- braic
In this paper we will write -[a 7→ -] as shorthand for (λa.-)-. Thus g[a 7→ h] stands for (λa.g)h and not for the term resulting from ‘substituting h for a in g’ (we write that as g[h/a], see Definition 44). The λ-calculus represents functions in programming languages [Pau96, Tho96], logic [Bar77, Lei94], theorem-provers [ABI96, Pau89], higher-order rewriting [BN98], and much more besides. Howe...
متن کاملTyped Syntax Macros
Using parser combinators we can dynamically generate parsers. We show how this property is used to define or to extend the syntax of a programming language from within a program itself, thus bringing the idea of “Syntax Macros” to life again. Part of the context-sensitive constraints that consequently have to be obeyed are enforced by dynamically constructing new parsers that only accept langua...
متن کامل